home *** CD-ROM | disk | FTP | other *** search
- ยป 4777
- ; ****************************************************************************
- ; *** RATSoft/ST Local Download Main Script v1.1a. November 20, 1995 ***
- ; *** Main Script: localdl.scp ***
- ; *** ***
- ; *** Developed and programmed by Daniel Hedberg of New Beat Development. ***
- ; ****************************************************************************
- ;
- datafile$=CONFIG$(25)+"LDL_PATH.DAT"
- temp$=CONFIG$(29)+"BATCHQUE.DAT"
- PAGEBREAK=OFF
- OUT "&90"
- CENTER "&58 RATSoft/ST Local Download Script v1.1a (November 20, 1995) &50"
- CENTER "Written by Daniel Hedberg of New Beat Development in RAT-Script"
- OUT
- IF EXIST(temp$)=FALSE
- CENTER "&57 You have no files marked for download. Download aborted &50"
- ELSE
- OPEN(temp$,INPUT)
- files%=0
- filesize%=0
- CENTER "&57 Checking Marked Files. Please Wait! &50";
- REPEAT
- files%=ADD(files%,1)
- filesize$=READ$
- filesize%=filesize%+VAL(filesize$)
- scrap$=READ$
- scrap$=READ$
- scrap$=READ$
- scrap$=READ$
- UNTIL EOF=TRUE
- CLOSE
- IF EXIST(datafile$)=FALSE
- OPEN(datafile$,OUTPUT)
- WRITE "C:\"
- CLOSE
- ELSE
- OPEN(datafile$,INPUT)
- default$=READ$
- CLOSE
- ENDIF
- _restart:
- OUT "&90"
- CENTER "&58 RATSoft/ST Local Download Script v1.1a (November 20, 1995) &50"
- CENTER "Written by Daniel Hedberg of New Beat Development in RAT-Script"
- OUT
- OUT "Please enter a destination path for the marked file(s), or press [RETURN]"
- OUT "to use the last used destination path: &57 "+UPPER$(default$)+" &50"
- OUT
- OUT " You have &57 "+STR$(files%)+" &50 file(s) marked, in &57 "+STR$(filesize%)+" &50 bytes."
- OUT
- _enter_destination_path:
- OUT "Destination path: ";
- dest_path$=INPUT$(58,TRUE)
- start%=RINSTR(dest_path$,"\",1000)
- length%=LEN(dest_path$)
- length%=SUB(length%,start%)
- IF length%>0
- dest_path$=dest_path$+"\"
- ENDIF
- IF dest_path$=""
- dest_path$=default$
- ELSE IF MID$(dest_path$,2,2)<>":\"
- OUT "Error! Invalid path."
- OUT
- GOTO _enter_destination_path
- ENDIF
- OUT
- OUT "Are you sure? [Y/n/q] ";
- _get_key1:
- REPEAT
- inkey$=KEY
- UNTIL inkey$<>""
- IF UPPER$(inkey$)="Y"
- GOTO _continue1
- ELSE IF inkey$=CHR$(13)
- GOTO _continue1
- ELSE IF UPPER$(inkey$)="N"
- GOTO _restart
- ELSE IF UPPER$(inkey$)="Q"
- OUT
- GOTO _quit
- ELSE
- GOTO _get_key1
- ENDIF
- _continue1:
- dest_path$=UPPER$(dest_path$)
- device$=MID$(dest_path$,1,3)
- old_dir$=CUR_DIR$
- OUT
- OUT
- CHECK_PATH(dest_path$)
- CHDIR dest_path$
- IF EXIST("*.*")=TRUE
- _not_empty:
- OUT "Warning! Destination directory is not empty."
- OUT "Do you want to delete the files(s) in the directory? [y/N/v/q] ";
- _get_key2:
- REPEAT
- inkey$=KEY
- UNTIL inkey$<>""
- IF UPPER$(inkey$)="V"
- OUT
- OUT
- OUT "&58 Viewing files... &50"
- OUT
- mask$=dest_path$+"*.*"
- f_loc%=ADD(DTA%,30)
- stat%=FSFIRST(mask$,3)
- PAGEBREAK=ON
- DO UNTIL stat%<>FALSE
- filename$=CHAR(f_loc%)
- OUT dest_path$+filename$
- stat%=FSNEXT
- LOOP
- PAGEBREAK=OFF
- OUT
- GOTO _not_empty
- ELSE IF UPPER$(inkey$)="Y"
- OUT
- OUT
- OUT "&58 Deleting files... &50"
- OUT
- mask$=dest_path$+"*.*"
- f_loc%=ADD(DTA%,30)
- stat%=FSFIRST(mask$,3)
- DO UNTIL stat%<>FALSE
- filename$=CHAR(f_loc%)
- OUT dest_path$+filename$;
- IF DOS(3,filename$)<>FALSE
- OUT " - Error! File is write protected."
- ENDIF
- OUT
- stat%=FSNEXT
- LOOP
- OUT
- GOTO _continue2
- ELSE IF inkey$=CHR$(13)
- OUT
- OUT
- GOTO _continue2
- ELSE IF UPPER$(inkey$)="N"
- OUT
- OUT
- GOTO _continue2
- ELSE IF UPPER$(inkey$)="Q"
- OUT
- GOTO _quit
- ELSE
- GOTO _get_key2
- ENDIF
- ENDIF
- _continue2:
- free%=DFREE
- CHDIR old_dir$
- IF free%<filesize%
- OUT "Aborted! Not enough free space on drive "+MID$(device$,1,2)+"."
- OUT
- GOTO _enter_destination_path
- ENDIF
- OUT "&58 Copying files... &50"
- OUT
- OPEN(temp$,INPUT)
- REPEAT
- filesize$=READ$
- source$=READ$
- scrap$=READ$
- scrap$=READ$
- scrap$=READ$
- start%=RINSTR(source$,"\",1000)+1
- filename$=MID$(source$,start%,12)
- dest$=dest_path$+filename$
- OUT UPPER$(source$)+" -> "+UPPER$(dest$)
- COPY(source$,dest$)
- UNTIL EOF=TRUE
- CLOSE
- OPEN(datafile$,OUTPUT)
- WRITE dest_path$
- CLOSE
- ENV "CM:[nque]"
- DOS(3,temp$)
- _quit:
- PAGEBREAK=ONE
- ENDIF
- EXIT
-